﻿

namespace SLG_Demo_0
{
	public class MapData
	{
		/// <summary>
		/// 所属地图对象
		/// </summary>
		private MapObject m_pMapObject = null;

		/// <summary>
		/// 地图数据层
		/// </summary>
		private CellData[,] m_Cells = null;

		/// <summary>
		/// 地图宽高
		/// </summary>
		public int m_width = 0, m_height = 0;


		////////////////////////////////////////////////////////////
		public CellData[,] Cells
		{
			get
			{
				return m_Cells;
			}

			set
			{
				m_Cells = value;
			}
		}

		public int CellNum
		{
			get
			{
				return m_width * m_height;
			}
		}


		////////////////////////////////////////////////////////////
		public void Create(MapObject pMapObj, int nWidth, int nHeight)
		{
			m_pMapObject = pMapObj;
			m_width = nWidth;
			m_height = nHeight;

			m_Cells = new CellData[m_width, m_height];
			for (int iRow = 0; iRow < m_height; ++iRow)
			{
				for (int iCol = 0; iCol < m_width; ++iCol)
				{
					m_Cells[iCol, iRow] = new CellData(pMapObj, iCol, iRow); ;
				}
			}
		}
	}
}
